import request from '@/utils/request'

/**
 * 获取奖励规则列表
 * @param params
 * @returns
 */
export function getRewardRuleList(params: Record<string, any>) {
    return request.get(`sow_community/reward_rule`, { params })
}

/**
 * 获取奖励字典
 * @param params
 * @returns
 */
export function getRewardRuleDict() {
    return request.get(`sow_community/dict/package_gift`)
}

/**
 * 添加内容
 * @param params
 * @returns
 */
export function addRewardRule(params: Record<string, any>) {
    return request.post('sow_community/reward_rule', params, { showErrorMessage: true, showSuccessMessage: true })
}

/**
 * 编辑内容
 * @param params
 * @returns
 */
export function editRewardRule(params: Record<string, any>) {
    return request.put(`sow_community/reward_rule/${ params.rule_id }`, params, {
        showErrorMessage: true,
        showSuccessMessage: true
    })
}

/**
 * 获取详情
 * @param rule_id 
 * @returns
 */
export function getRewardRuleInfo(rule_id: number) {
    return request.get(`sow_community/reward_rule/${ rule_id }`);
}

/**
 * 修改状态
 * @param params
 */
export function modifyRewardRuleStatus(params: Record<string, any>) {
    return request.put(`sow_community/reward_rule/status/${params.rule_id}`,params, { showSuccessMessage: true })
}

/**
 * 获取奖励规则记录
 * @param rule_id 
 * @returns
 */
export function getRewardRuleReward(params:Record<string,any>) {
    return request.get(`sow_community/reward_rule/reward/${params.id}`, { params })
}
// 删除
export function deleteRewardRule(params:Record<string,any>) {
    return request.post(`sow_community/reward_rule/batch_del`,params, { showSuccessMessage: true })
}